package com.lvan.websocket.chat.controller;

import com.lvan.websocket.chat.config.WebSocketEndpoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 具体业务
 *
 * @author Lvan
 */
@RestController
@RequestMapping("/work")
@CrossOrigin
public class WorkController {

    @Autowired
    private WebSocketEndpoint webSocket;

    @GetMapping("socket")
    public String sendMessage(@RequestParam("msg") String msg) {
        webSocket.sendMessage(msg);
        return "ok";
    }

}
